﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using KKSG;
using MiniJSON;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUpdater;
using XUtliPoolLib;

namespace XMainClient
{
	// Token: 0x020009B4 RID: 2484
	internal class XLoginDocument : XSingleton<XLoginDocument>
	{
		// Token: 0x17002D4F RID: 11599
		// (get) Token: 0x06009659 RID: 38489 RVA: 0x0016AF24 File Offset: 0x00169124
		// (set) Token: 0x0600965A RID: 38490 RVA: 0x0016AF3C File Offset: 0x0016913C
		public XLoginView View
		{
			get
			{
				return this._view;
			}
			set
			{
				this._view = value;
			}
		}

		// Token: 0x17002D50 RID: 11600
		// (get) Token: 0x0600965B RID: 38491 RVA: 0x0016AF48 File Offset: 0x00169148
		public PlatNotice Announcement
		{
			get
			{
				return this._announcement;
			}
		}

		// Token: 0x17002D51 RID: 11601
		// (get) Token: 0x0600965C RID: 38492 RVA: 0x0016AF60 File Offset: 0x00169160
		// (set) Token: 0x0600965D RID: 38493 RVA: 0x0016AF78 File Offset: 0x00169178
		public bool SDKSignOut
		{
			get
			{
				return this._sdk_sign_out;
			}
			set
			{
				this._sdk_sign_out = value;
			}
		}

		// Token: 0x17002D52 RID: 11602
		// (get) Token: 0x0600965E RID: 38494 RVA: 0x0016AF84 File Offset: 0x00169184
		// (set) Token: 0x0600965F RID: 38495 RVA: 0x0016AF9C File Offset: 0x0016919C
		private string _openid
		{
			get
			{
				return this.__openid;
			}
			set
			{
				this.__openid = value;
				XFileLog.OpenID = value;
				XSingleton<XUpdater.XUpdater>.singleton.XPlatform.SetApmUserID(value);
			}
		}

		// Token: 0x17002D53 RID: 11603
		// (get) Token: 0x06009660 RID: 38496 RVA: 0x0016AFC0 File Offset: 0x001691C0
		public uint LoginZoneID
		{
			get
			{
				return this._login_zoneid;
			}
		}

		// Token: 0x17002D54 RID: 11604
		// (get) Token: 0x06009661 RID: 38497 RVA: 0x0016AFD8 File Offset: 0x001691D8
		public bool freeflow
		{
			get
			{
				return this._freeflow;
			}
		}

		// Token: 0x17002D55 RID: 11605
		// (get) Token: 0x06009662 RID: 38498 RVA: 0x0016AFF0 File Offset: 0x001691F0
		public int cctype
		{
			get
			{
				return this._cctype;
			}
		}

		// Token: 0x17002D56 RID: 11606
		// (get) Token: 0x06009663 RID: 38499 RVA: 0x0016B008 File Offset: 0x00169208
		private float FetchingElapsed
		{
			get
			{
				return Time.realtimeSinceStartup - this._last_fetch_at;
			}
		}

		// Token: 0x17002D57 RID: 11607
		// (get) Token: 0x06009664 RID: 38500 RVA: 0x0016B028 File Offset: 0x00169228
		private float LoginingElapsed
		{
			get
			{
				return Time.realtimeSinceStartup - this._last_login_at;
			}
		}

		// Token: 0x17002D58 RID: 11608
		// (get) Token: 0x06009665 RID: 38501 RVA: 0x0016B048 File Offset: 0x00169248
		public string Account
		{
			get
			{
				return this._account;
			}
		}

		// Token: 0x17002D59 RID: 11609
		// (get) Token: 0x06009666 RID: 38502 RVA: 0x0016B060 File Offset: 0x00169260
		public string Password
		{
			get
			{
				return this._pwd;
			}
		}

		// Token: 0x17002D5A RID: 11610
		// (get) Token: 0x06009667 RID: 38503 RVA: 0x0016B078 File Offset: 0x00169278
		public string OpenID
		{
			get
			{
				return this._openid;
			}
		}

		// Token: 0x17002D5B RID: 11611
		// (get) Token: 0x06009668 RID: 38504 RVA: 0x0016B090 File Offset: 0x00169290
		public XAuthorizationChannel Channel
		{
			get
			{
				return this._channel;
			}
		}

		// Token: 0x17002D5C RID: 11612
		// (get) Token: 0x06009669 RID: 38505 RVA: 0x0016B0A8 File Offset: 0x001692A8
		public string TokenCache
		{
			get
			{
				return this._token_cache;
			}
		}

		// Token: 0x17002D5D RID: 11613
		// (get) Token: 0x0600966A RID: 38506 RVA: 0x0016B0C0 File Offset: 0x001692C0
		public bool FetchTokenDelay
		{
			get
			{
				return this._fetch_delay;
			}
		}

		// Token: 0x17002D5E RID: 11614
		// (get) Token: 0x0600966B RID: 38507 RVA: 0x0016B0D8 File Offset: 0x001692D8
		public bool LoginDelay
		{
			get
			{
				return this._login_delay;
			}
		}

		// Token: 0x17002D5F RID: 11615
		// (get) Token: 0x0600966C RID: 38508 RVA: 0x0016B0F0 File Offset: 0x001692F0
		public bool Authorized
		{
			get
			{
				return this._authorized;
			}
		}

		// Token: 0x17002D60 RID: 11616
		// (get) Token: 0x0600966D RID: 38509 RVA: 0x0016B108 File Offset: 0x00169308
		public List<string> ZoneList
		{
			get
			{
				return this._zone_list;
			}
		}

		// Token: 0x17002D61 RID: 11617
		// (get) Token: 0x0600966E RID: 38510 RVA: 0x0016B120 File Offset: 0x00169320
		public Dictionary<string, List<int>> ServerCategory
		{
			get
			{
				return this._server_category;
			}
		}

		// Token: 0x17002D62 RID: 11618
		// (get) Token: 0x0600966F RID: 38511 RVA: 0x0016B138 File Offset: 0x00169338
		public uint RoleCountInQueue
		{
			get
			{
				return this._role_count_inqueue;
			}
		}

		// Token: 0x17002D63 RID: 11619
		// (get) Token: 0x06009670 RID: 38512 RVA: 0x0016B150 File Offset: 0x00169350
		public uint LeftTimeInQueue
		{
			get
			{
				return this._left_time_inqueue;
			}
		}

		// Token: 0x17002D64 RID: 11620
		// (get) Token: 0x06009671 RID: 38513 RVA: 0x0016B168 File Offset: 0x00169368
		public List<ServerInfo> BackFlowServerList
		{
			get
			{
				return this._backFlowServerList;
			}
		}

		// Token: 0x06009672 RID: 38514 RVA: 0x0016B180 File Offset: 0x00169380
		private void ResetAccoutInfo()
		{
			this._sdk_sign_out = false;
			this._account = null;
			this._pwd = null;
			this._openid = null;
			this._token_cache = null;
		}

		// Token: 0x06009673 RID: 38515 RVA: 0x0016B1A8 File Offset: 0x001693A8
		public void SetChannelByWakeUp()
		{
			switch (this.GetWakeUpType())
			{
			case StartUpType.StartUp_QQ:
				this._channel = XAuthorizationChannel.XAuthorization_QQ;
				break;
			case StartUpType.StartUp_WX:
				this._channel = XAuthorizationChannel.XAuthorization_WeChat;
				break;
			}
		}

		// Token: 0x06009674 RID: 38516 RVA: 0x0016B1E8 File Offset: 0x001693E8
		private void SetChannelByLaunchType()
		{
			switch (this.GetLaunchType())
			{
			case StartUpType.StartUp_QQ:
				this._channel = XAuthorizationChannel.XAuthorization_QQ;
				break;
			case StartUpType.StartUp_WX:
				this._channel = XAuthorizationChannel.XAuthorization_WeChat;
				break;
			}
		}

		// Token: 0x06009675 RID: 38517 RVA: 0x0016B228 File Offset: 0x00169428
		public void LoadAccount()
		{
			string path = Application.persistentDataPath + "/account.txt";
			if ((Application.platform == RuntimePlatform.WindowsEditor) || (Application.platform == RuntimePlatform.OSXEditor) || (Application.platform == RuntimePlatform.WindowsPlayer))
			{
				path = Application.dataPath + "/account.txt";
			}
			if (!File.Exists(path))
			{
				this.SetChannelByLaunchType();
			}
			else
			{
				string text = this.XCryptography(File.ReadAllBytes(path));
				string[] array = text.Split(null);
				int num = 0;
				if (int.TryParse(array[0], out num) && num > 0 && num < XFastEnumIntEqualityComparer<XAuthorizationChannel>.ToInt(XAuthorizationChannel.XAuthorization_Max))
				{
					this._channel = (XAuthorizationChannel)num;
					this.SetChannelByLaunchType();
					switch (this._channel)
					{
                        case XAuthorizationChannel.XAuthorization_Internal:
                            {
                                if (array.Length == 3)
                                {
                                    this._account = array[1];
                                    this._pwd = array[2];
                                }
                                break;
                            }
                    }
				}
				else
				{
					this.SetChannelByLaunchType();
				}
			}
		}

		// Token: 0x06009676 RID: 38518 RVA: 0x0016B344 File Offset: 0x00169544
		public void DelAccount()
		{
			string path = Application.persistentDataPath + "/account.txt";
			if ((Application.platform == RuntimePlatform.WindowsEditor) || (Application.platform == RuntimePlatform.OSXEditor) || (Application.platform == RuntimePlatform.WindowsPlayer))
			{
				path = Application.dataPath + "/account.txt";
			}
			try
			{
				if (File.Exists(path))
				{
					File.Delete(path);
				}
			}
			catch (Exception ex)
			{
				XSingleton<XDebug>.singleton.AddErrorLog("Delete account file failed " + ex.Message, null, null, null, null, null);
			}
		}

		public uint testTick = 0;
		public uint testTick2 = 0;
		XTimerMgr.ElapsedEventHandler _onTimerTestTick = null;
		XTimerMgr.ElapsedEventHandler _onTimerTestTick2 = null;
		// Token: 0x06009677 RID: 38519 RVA: 0x0016B3E0 File Offset: 0x001695E0
		public void AutoAuthorization(bool fromLoginStage)
		{
			if(XDebug.isLocalTest) //zcg
            {
				EnterLoalTest();
			}
            else
            {
				this.Authorization(this._channel, fromLoginStage, true, this._account, this._pwd);
			}
			
		}

		public void EnterLoalTest()
		{
			byte[] datas = XUtliPoolLib.XFileLog.ReadProto("PtcG2C_SelectRoleNtf");
			if (datas == null)
			{
				XSingleton<XDebug>.singleton.AddWarningLog("zcg ReadProto PtcG2C_SelectRoleNtf datas null.");
				return;
			}
			MemoryStream stream = new MemoryStream(datas);
			PtcG2C_SelectRoleNtf proto = new PtcG2C_SelectRoleNtf();
			proto.DeSerialize(stream);
			proto.Process();

			if (_onTimerTestTick == null)
			{
				this._onTimerTestTick = new XTimerMgr.ElapsedEventHandler(this.OnStartSyncTime);
			}

			XSingleton<XTimerMgr>.singleton.KillTimer(this.testTick);
			this.testTick = XSingleton<XTimerMgr>.singleton.SetGlobalTimer((float)1, this._onTimerTestTick, null);
		}

		public void ReqEnterScene(uint sceneid)
		{
			// 			MemoryStream stream = new MemoryStream(XUtliPoolLib.XFileLog.ReadProto("PtcG2C_EnterSceneNtf"));
			// 			PtcG2C_EnterSceneNtf sceneproto = new PtcG2C_EnterSceneNtf();
			// 			sceneproto.DeSerialize(stream);
			// 			sceneproto.Data.SceneID = sceneid;
			// 			sceneproto.Process();
			XSingleton<XTimerMgr>.singleton.KillTimer(this.testTick);
			this.testTick = XSingleton<XTimerMgr>.singleton.SetGlobalTimer((float)1, this._onTimerTestTick, sceneid);
		}

		public void DoEnterScene(RpcC2G_DoEnterScene DoEnterSceneRpc)
        {
            if (_onTimerTestTick2 == null)
            {
                this._onTimerTestTick2 = new XTimerMgr.ElapsedEventHandler(this.OnStartSyncTime2);
            }
            MemoryStream stream = new MemoryStream(XUtliPoolLib.XFileLog.ReadProto("RpcC2G_DoEnterScene"));
            XSingleton<XDebug>.singleton.AddWarningLog("zcg DoEnterSceneRpc.Process.");
            DoEnterSceneRpc.DeSerialize(stream);
            DoEnterSceneRpc.Process();
            XSingleton<XDebug>.singleton.AddWarningLog("zcg DoEnterScene............");
			//XSingleton<XTimerMgr>.singleton.KillTimer(this.testTick2);
            //this.testTick2 = XSingleton<XTimerMgr>.singleton.SetGlobalTimer((float)1, this._onTimerTestTick2, DoEnterSceneRpc);
        }

		private void OnStartSyncTime(object param)
        {
            MemoryStream stream = new MemoryStream(XUtliPoolLib.XFileLog.ReadProto("PtcG2C_EnterSceneNtf"));
			PtcG2C_EnterSceneNtf proto = new PtcG2C_EnterSceneNtf();
            proto.DeSerialize(stream);
			if(param != null)
			{
				proto.Data.SceneID = (uint)param;
			}
            proto.Process();
        }

        private void OnStartSyncTime2(object param)
        {
			XSingleton<XDebug>.singleton.AddWarningLog("zcg DoEnterSceneRpc.Process11.");
			RpcC2G_DoEnterScene DoEnterSceneRpc = (RpcC2G_DoEnterScene)param;

			MemoryStream stream = new MemoryStream(XUtliPoolLib.XFileLog.ReadProto("RpcC2G_DoEnterScene"));
			XSingleton<XDebug>.singleton.AddWarningLog("zcg DoEnterSceneRpc.Process.");
			DoEnterSceneRpc.DeSerialize(stream);
			DoEnterSceneRpc.Process();
        }

        // Token: 0x06009678 RID: 38520 RVA: 0x0016B400 File Offset: 0x00169600
        public bool CheckLoginBlockTime()
		{
			return Time.time - this.lastLoginTime[1] > XSingleton<XGlobalConfig>.singleton.LoginBlockTime;
		}

		// Token: 0x06009679 RID: 38521 RVA: 0x0016B42C File Offset: 0x0016962C
		public void Authorization(XAuthorizationChannel channel, bool fromLoginStage, bool auto = false, string account = null, string pwd = null)
		{
			this.lastLoginTime[1] = this.lastLoginTime[0];
			this.lastLoginTime[0] = Time.time;
			this.SetBlockUIVisable(true);
			this._authorized = false;
			this._auto_authorization = auto;
			this._authorized_from_login_stage = fromLoginStage;
			this._fetching_token = true;
			this._last_fetch_at = Time.realtimeSinceStartup;
			switch (channel)
			{
			case XAuthorizationChannel.XAuthorization_Internal:
				this._channel = channel;
				this.InternalAuthorization(account, pwd);
				break;
			case XAuthorizationChannel.XAuthorization_SD:
				this._channel = channel;
				this.PlatformAuthorization();
				break;
			case XAuthorizationChannel.XAuthorization_QQ:
				this._channel = channel;
				this.QQAuthorization(auto);
				break;
			case XAuthorizationChannel.XAuthorization_WeChat:
				this._channel = channel;
				this.WeChatAuthorization(auto);
				break;
			case XAuthorizationChannel.XAuthorization_Guest:
				this._channel = channel;
				this.GuestAuthorization(auto);
				break;
			default:
				this._fetching_token = false;
				break;
			}
		}

		// Token: 0x0600967A RID: 38522 RVA: 0x0016B514 File Offset: 0x00169714
		public void ShowAfterLoginAnnouncement()
		{
			if (!this._after_login_announcement)
			{
				XSingleton<UiUtility>.singleton.ShowAfterLoginAnnouncement(this._announcement);
				this._after_login_announcement = true;
			}
		}

		// Token: 0x0600967B RID: 38523 RVA: 0x0016B54C File Offset: 0x0016974C
		public void OnError(string notify)
		{
			XSingleton<XPandoraSDKDocument>.singleton.PandoraLogout();
			this._fetching_token = false;
			this._authorized = false;
			this._logining = false;
			this._in_server_queue = false;
			if (this._channel != XAuthorizationChannel.XAuthorization_Internal && this._channel != XAuthorizationChannel.XAuthorization_Max)
			{
				this.ResetAccoutInfo();
			}
			if (!string.IsNullOrEmpty(notify))
			{
				XSingleton<UiUtility>.singleton.ShowLoginTip(string.Format("{0} {1}", this.PlatformComment(this._channel), notify));
			}
			this.FromBegining();
		}

		// Token: 0x0600967C RID: 38524 RVA: 0x0016B5DC File Offset: 0x001697DC
		public void OnError()
		{
			this._fetching_token = false;
			this._authorized = false;
			this._logining = false;
			this._in_server_queue = false;
		}

		// Token: 0x0600967D RID: 38525 RVA: 0x0016B5FC File Offset: 0x001697FC
		public void FromBegining()
		{
			XSingleton<XClientNetwork>.singleton.ClearServerInfo();
			this.SetBlockUIVisable(false);
			if (this._authorized_from_login_stage)
			{
				this.ShowLoginUI();
			}
			else
			{
				this.BackToBegin();
			}
			this._after_login_announcement = false;
			this._authorized_from_login_stage = false;
		}

		// Token: 0x0600967E RID: 38526 RVA: 0x0016B64C File Offset: 0x0016984C
		public void FromLogining()
		{
			this.SetBlockUIVisable(false);
			if (this._authorized_from_login_stage)
			{
				this.ShowLoginSelectServerUI();
			}
			else
			{
				this.BackToLogin();
			}
			this._authorized_from_login_stage = false;
		}

		// Token: 0x0600967F RID: 38527 RVA: 0x0016B689 File Offset: 0x00169889
		public void RefreshAccessToken(string token)
		{
			this._token_cache = token;
			XSingleton<XDebug>.singleton.AddLog("AccessToken : ", this._token_cache, null, null, null, null, XDebugColor.XDebug_None);
		}

		// Token: 0x06009680 RID: 38528 RVA: 0x0016B6B0 File Offset: 0x001698B0
		public void OnAuthorization(string account, string pwd, string openid, XAuthorizationChannel channel)
		{
			this._fetching_token = false;
			this._account = account;
			this._pwd = pwd;
			this._openid = openid;
			this._channel = channel;
			this._token_cache = account;
			if (string.IsNullOrEmpty(account) || string.IsNullOrEmpty(openid))
			{
				if(channel == XAuthorizationChannel.XAuthorization_Internal)
				{
					XDebug.isLocalTest = true;
					XSingleton<XLoginDocument>.singleton.EnterLoalTest();
				}
				else
				{
					this.OnAuthorizedFailed();
				}
				
			}
			else
			{
				switch (channel)
				{
				case XAuthorizationChannel.XAuthorization_Internal:
					XSingleton<XClientNetwork>.singleton.Authorization(LoginType.LOGIN_PASSWORD, account, pwd, openid);
					break;
				case XAuthorizationChannel.XAuthorization_SD:
					XSingleton<XClientNetwork>.singleton.Authorization(LoginType.LOGIN_SNDA_PF, account, pwd, openid);
					break;
				case XAuthorizationChannel.XAuthorization_QQ:
					XSingleton<XClientNetwork>.singleton.Authorization(LoginType.LOGIN_QQ_PF, account, pwd, openid);
					break;
				case XAuthorizationChannel.XAuthorization_WeChat:
					XSingleton<XClientNetwork>.singleton.Authorization(LoginType.LGOIN_WECHAT_PF, account, pwd, openid);
					break;
				case XAuthorizationChannel.XAuthorization_Guest:
					XSingleton<XClientNetwork>.singleton.Authorization(LoginType.LOGIN_IOS_GUEST, account, pwd, openid);
					break;
				}
			}
		}

		// Token: 0x06009681 RID: 38529 RVA: 0x0016B790 File Offset: 0x00169990
		public void OnAuthorizationSignOut(string msg)
		{
			if (this._channel != XAuthorizationChannel.XAuthorization_Max)
			{
				this._sdk_sign_out = true;
				if (!XStage.IsConcreteStage(XSingleton<XGame>.singleton.CurrentStage.Stage))
				{
					if (string.IsNullOrEmpty(msg))
					{
						this._authorized = false;
					}
					else
					{
						XSingleton<UiUtility>.singleton.ShowLoginTip(string.Format("{0} {1}", this.PlatformComment(this._channel), msg));
					}
					this.FromBegining();
				}
				else
				{
					XSingleton<XDebug>.singleton.AddLog("OnAuthorizationSignOut " + msg, null, null, null, null, null, XDebugColor.XDebug_None);
					XSingleton<XClientNetwork>.singleton.Close(NetErrCode.Net_NoError);
					if (XSingleton<XScene>.singleton.SceneReady)
					{
						XSingleton<UiUtility>.singleton.OnFatalErrorClosed(ErrorCode.ERR_AUTH_TOKEN_INVALID);
					}
					else
					{
						XSingleton<XScene>.singleton.Error = ErrorCode.ERR_AUTH_TOKEN_INVALID;
					}
				}
				this._channel = XAuthorizationChannel.XAuthorization_Max;
			}
		}

		// Token: 0x06009682 RID: 38530 RVA: 0x0016B878 File Offset: 0x00169A78
		public void AuthorizationSignOut()
		{
			if (this._channel != XAuthorizationChannel.XAuthorization_Max)
			{
				this._authorized = false;
				if (this._channel != XAuthorizationChannel.XAuthorization_Internal)
				{
					this.ResetAccoutInfo();
					XSingleton<XUpdater.XUpdater>.singleton.XPlatform.LogOut();
				}
				this.DelAccount();
				XSingleton<XPandoraSDKDocument>.singleton.PandoraLogout();
				this._channel = XAuthorizationChannel.XAuthorization_Max;
				this.FromBegining();
			}
		}

		// Token: 0x06009683 RID: 38531 RVA: 0x0016B8F4 File Offset: 0x00169AF4
		public void OnAuthorized(string identification)
		{
			if (this._channel == XAuthorizationChannel.XAuthorization_SD)
			{
				this._account = string.Format("{0} ({1})", identification, XStringDefineProxy.GetString("SDO_TOKEN"));
			}
			if (this._channel == XAuthorizationChannel.XAuthorization_QQ)
			{
				this._account = identification + " (QQ)";
			}
			if (this._channel == XAuthorizationChannel.XAuthorization_WeChat)
			{
				this._account = string.Format("{0} ({1})", identification, XStringDefineProxy.GetString("WECHAT_TOKEN"));
			}
			if (this._channel == XAuthorizationChannel.XAuthorization_Guest)
			{
				this._account = string.Format("{0} ({1})", identification, XStringDefineProxy.GetString("GUEST_TOKEN"));
			}
			if (!this._auto_authorization || this._authorized_from_login_stage)
			{
				XSingleton<UiUtility>.singleton.ShowLoginTip(string.Format("{0} {1}", this.PlatformComment(this._channel), XStringDefineProxy.GetString("AUTHORIZED_SUCCESS")));
			}
			this.SaveAccount();
			this._authorized = true;
			this.ShowLoginSelectServerUI();
			this.SetBlockUIVisable(false);
			XSingleton<XClientNetwork>.singleton.XLoginStep = XLoginStep.Login;
		}

		// Token: 0x06009684 RID: 38532 RVA: 0x0016BA04 File Offset: 0x00169C04
		public void OnAuthorizedFailed()
		{
			XSingleton<UiUtility>.singleton.ShowLoginTip(string.Format("{0} {1}", this.PlatformComment(this._channel), XStringDefineProxy.GetString("AUTHORIZED_FAIL")));
			string sdkconfig = XSingleton<XUpdater.XUpdater>.singleton.XPlatform.GetSDKConfig("get_login_eflag", "");
			if (this._channel != XAuthorizationChannel.XAuthorization_Internal && this._channel != XAuthorizationChannel.XAuthorization_Max)
			{
				this.ResetAccoutInfo();
			}
			XSingleton<PDatabase>.singleton.playerInfo = null;
			XSingleton<PDatabase>.singleton.friendsInfo = null;
			this._authorized = false;
			this.OnError();
			this.FromBegining();
		}

		// Token: 0x06009685 RID: 38533 RVA: 0x0016BAA8 File Offset: 0x00169CA8
		public void OnAuthorizedConnectFailed()
		{
			if (this._channel != XAuthorizationChannel.XAuthorization_Internal && this._channel != XAuthorizationChannel.XAuthorization_Max)
			{
				this.ResetAccoutInfo();
			}
			XSingleton<PDatabase>.singleton.playerInfo = null;
			XSingleton<PDatabase>.singleton.friendsInfo = null;
			XSingleton<UiUtility>.singleton.ShowLoginTip(string.Format("{0} {1}", this.PlatformComment(this._channel), XStringDefineProxy.GetString("AUTHORIZED_CONNECT_FAIL")));
			this._authorized = false;
			this.OnError();
			this.FromBegining();
		}

		// Token: 0x06009686 RID: 38534 RVA: 0x0016BB34 File Offset: 0x00169D34
		public void OnAuthorizedTimeOut()
		{
			if (this._channel != XAuthorizationChannel.XAuthorization_Internal && this._channel != XAuthorizationChannel.XAuthorization_Max)
			{
				this.ResetAccoutInfo();
			}
			XSingleton<PDatabase>.singleton.playerInfo = null;
			XSingleton<PDatabase>.singleton.friendsInfo = null;
			XSingleton<UiUtility>.singleton.ShowLoginTip(this.PlatformComment(this._channel) + " 授权验证超时");
			this._authorized = false;
			this.FromBegining();
		}

		// Token: 0x06009687 RID: 38535 RVA: 0x0016BBAC File Offset: 0x00169DAC
		public void Login()
		{
			this.SetBlockUIVisable(true);
			this._logining = true;
			this._last_login_at = Time.realtimeSinceStartup;
			this._in_server_queue = false;
			XSingleton<XClientNetwork>.singleton.Login();
		}

		// Token: 0x06009688 RID: 38536 RVA: 0x0016BBDC File Offset: 0x00169DDC
		public void OnLogin()
		{
			if (this._authorized_from_login_stage)
			{
				this._view.TweenAlpha(true);
			}
			XSingleton<XClientNetwork>.singleton.OnLogin();
			this._logining = false;
			this._authorized_from_login_stage = false;
			this._in_server_queue = false;
			this.SetBlockUIVisable(false);
		}

		// Token: 0x06009689 RID: 38537 RVA: 0x0016BC2C File Offset: 0x00169E2C
		public StartUpType GetWakeUpType()
		{
			StartUpType startUpType = StartUpType.StartUp_Normal;
			string sdkconfig = XSingleton<XUpdater.XUpdater>.singleton.XPlatform.GetSDKConfig("get_wakeup_info", "");
			XSingleton<XDebug>.singleton.AddLog("[GetLaunchType] wakeupInfo:" + sdkconfig, null, null, null, null, null, XDebugColor.XDebug_None);
			if (sdkconfig == "")
			{
				return startUpType;
			}

			Dictionary<string, object> dictionary = Json.Deserialize(sdkconfig) as Dictionary<string, object>;
			object obj = null;
			if (dictionary != null && dictionary.TryGetValue("wakeup_platform", out obj))
			{
				XSingleton<XDebug>.singleton.AddLog("[GetLaunchType] platform: " + obj.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
				if ((long)obj == 1L)
				{
					startUpType = StartUpType.StartUp_WX;
				}
				else if ((long)obj == 2L)
				{
					startUpType = StartUpType.StartUp_QQ;
				}
			}
			return startUpType;

		}

		// Token: 0x0600968A RID: 38538 RVA: 0x0016BD04 File Offset: 0x00169F04
		public StartUpType GetLaunchType()
		{
			StartUpType startUpType = StartUpType.StartUp_Normal;
			string sdkconfig = XSingleton<XUpdater.XUpdater>.singleton.XPlatform.GetSDKConfig("get_wakeup_info", "");
			XSingleton<XDebug>.singleton.AddLog("[GetLaunchType] wakeupInfo:" + sdkconfig, null, null, null, null, null, XDebugColor.XDebug_None);
			if (sdkconfig == "")
			{
				return startUpType;
			}

			Dictionary<string, object> dictionary = Json.Deserialize(sdkconfig) as Dictionary<string, object>;
			object obj = null;
			if (dictionary != null && dictionary.TryGetValue("wakeup_platform", out obj))
			{
				XSingleton<XDebug>.singleton.AddLog("[GetLaunchType] platform: " + obj.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
				if ((long)obj == 1L)
				{
					XSingleton<XDebug>.singleton.AddLog("[GetLaunchType] platform == 1", null, null, null, null, null, XDebugColor.XDebug_None);
					object obj2 = null;
					if (dictionary.TryGetValue("wakeup_wx_extInfo", out obj2))
					{
						if (obj2.ToString() == "WX_GameCenter")
						{
							startUpType = StartUpType.StartUp_WX;
							XSingleton<XDebug>.singleton.AddLog("[GetLaunchType] StartUpType.StartUp_WX", null, null, null, null, null, XDebugColor.XDebug_None);
						}
					}
				}
				else
				{
					if ((long)obj == 2L)
					{
						XSingleton<XDebug>.singleton.AddLog("[GetLaunchType] platform == 2", null, null, null, null, null, XDebugColor.XDebug_None);
						object obj3 = null;
						if (dictionary.TryGetValue("wakeup_qq_extInfo", out obj3))
						{
							if (obj3.ToString() == "sq_gamecenter")
							{
								startUpType = StartUpType.StartUp_QQ;
								XSingleton<XDebug>.singleton.AddLog("[GetLaunchType] StartUpType.StartUp_QQ", null, null, null, null, null, XDebugColor.XDebug_None);
							}
						}
					}
				}
			}
			return startUpType;
		}

		// Token: 0x0600968B RID: 38539 RVA: 0x0016BE9B File Offset: 0x0016A09B
		public void SetLaunchTypeServerInfo(StartUpType type)
		{
			this._LaunchTypeServer = type;
		}

		// Token: 0x0600968C RID: 38540 RVA: 0x0016BEA8 File Offset: 0x0016A0A8
		public StartUpType GetLaunchTypeServerInfo()
		{
			return this._LaunchTypeServer;
		}

		// Token: 0x0600968D RID: 38541 RVA: 0x0016BEC0 File Offset: 0x0016A0C0
		public void EnterToSelectChar()
		{
			this.OnLogin();
			EXStage stage = XSingleton<XGame>.singleton.CurrentStage.Stage;
			if (stage == EXStage.Login)
            {
				XSingleton<XGame>.singleton.CurrentStage.Play();
			}
			else if (stage == EXStage.SelectChar)
			{
                XSelectcharStage xselectcharStage = XSingleton<XGame>.singleton.CurrentStage as XSelectcharStage;
                xselectcharStage.ReLogined();
            }
		}

		// Token: 0x0600968E RID: 38542 RVA: 0x0016BF24 File Offset: 0x0016A124
		public void CheckQueueState(object o)
		{
			XSingleton<XTimerMgr>.singleton.KillTimer(this._query_queue_token);
			this._query_queue_token = 0U;
			if (DlgBase<XLoginView, LoginWindowBehaviour>.singleton.IsVisible())
			{
				if (this._in_server_queue)
				{
					PtcC2M_CheckQueuingReq ptcC2M_CheckQueuingReq = new PtcC2M_CheckQueuingReq();
					ptcC2M_CheckQueuingReq.Data.iscancel = false;
					XSingleton<XClientNetwork>.singleton.Send(ptcC2M_CheckQueuingReq);
					this._query_queue_token = XSingleton<XTimerMgr>.singleton.SetTimer(5f, new XTimerMgr.ElapsedEventHandler(this.CheckQueueState), null);
				}
			}
		}

		// Token: 0x0600968F RID: 38543 RVA: 0x0016BFB0 File Offset: 0x0016A1B0
		public void CancelQueue()
		{
			PtcC2M_CheckQueuingReq ptcC2M_CheckQueuingReq = new PtcC2M_CheckQueuingReq();
			ptcC2M_CheckQueuingReq.Data.iscancel = true;
			XSingleton<XClientNetwork>.singleton.Send(ptcC2M_CheckQueuingReq);
			this.OnCancelServerQueue();
		}

		// Token: 0x06009690 RID: 38544 RVA: 0x0016BFE4 File Offset: 0x0016A1E4
		public void ShowServerQueue()
		{
			if (DlgBase<XLoginView, LoginWindowBehaviour>.singleton.IsVisible())
			{
				this._in_server_queue = true;
				DlgBase<XLoginView, LoginWindowBehaviour>.singleton.ShowQueue();
				this.CheckQueueState(null);
				this.SetBlockUIVisable(false);
			}
		}

		// Token: 0x06009691 RID: 38545 RVA: 0x0016C028 File Offset: 0x0016A228
		public void WaitForServerQueue(uint roleCount, uint leftTime)
		{
			this._role_count_inqueue = roleCount;
			this._left_time_inqueue = leftTime;
			if (DlgBase<XLoginView, LoginWindowBehaviour>.singleton.IsVisible())
			{
				DlgBase<XLoginView, LoginWindowBehaviour>.singleton.RefreshQueueState();
			}
		}

		// Token: 0x06009692 RID: 38546 RVA: 0x0016C064 File Offset: 0x0016A264
		public void OnLoginFailed(string error)
		{
			XSingleton<UiUtility>.singleton.ShowLoginTip(string.Format("{0} {1}", this.PlatformComment(this._channel), string.IsNullOrEmpty(error) ? XStringDefineProxy.GetString("LOGIN_FAIL") : error));
			this._logining = false;
			this._in_server_queue = false;
			this.FromLogining();
		}

		// Token: 0x06009693 RID: 38547 RVA: 0x0016C0C0 File Offset: 0x0016A2C0
		public void OnLoginTimeout()
		{
			XSingleton<UiUtility>.singleton.ShowLoginTip(string.Format("{0} {1}", this.PlatformComment(this._channel), XStringDefineProxy.GetString("LOGIN_TIMEOUT")));
			this._logining = false;
			this._in_server_queue = false;
			this.FromLogining();
		}

		// Token: 0x06009694 RID: 38548 RVA: 0x0016C110 File Offset: 0x0016A310
		public void OnLoginConnectFailed()
		{
			XSingleton<UiUtility>.singleton.ShowLoginTip(string.Format("{0} {1}", this.PlatformComment(this._channel), XStringDefineProxy.GetString("LOGIN_CONNECT_FAIL")));
			this._logining = false;
			this._in_server_queue = false;
			this.FromLogining();
		}

		// Token: 0x06009695 RID: 38549 RVA: 0x0016C15E File Offset: 0x0016A35E
		public void OnCancelServerQueue()
		{
			XSingleton<UiUtility>.singleton.ShowLoginTip(XStringDefineProxy.GetString("CANCEL_QUEUE"));
			this._logining = false;
			this._in_server_queue = false;
			XSingleton<XClientNetwork>.singleton.Close(NetErrCode.Net_NoError);
			this._authorized_from_login_stage = true;
			this.FromLogining();
		}

		// Token: 0x06009696 RID: 38550 RVA: 0x0016C1A0 File Offset: 0x0016A3A0
		public void EnterWorld(int index)
		{
			if ((Time.time - this.enterWorldTime) >= 2f)
			{
				this.enterWorldTime = Time.time;
				if (index > 0)
				{
					RpcC2M_SelectRoleNew rpcC2M_SelectRoleNew = new RpcC2M_SelectRoleNew();
					rpcC2M_SelectRoleNew.oArg.index = index - 1;
					XSingleton<XClientNetwork>.singleton.Send(rpcC2M_SelectRoleNew);
				}
				XSingleton<XClientNetwork>.singleton.XLoginToken = null;
			}
		}

		// Token: 0x06009697 RID: 38551 RVA: 0x0016C20C File Offset: 0x0016A40C
		public void CreateChar(string name, RoleType type)
		{
			if ((Time.time - this.enterWorldTime) >= 2f)
			{
				this.enterWorldTime = Time.time;
				RpcC2M_CreateRoleNew rpcC2M_CreateRoleNew = new RpcC2M_CreateRoleNew();
				rpcC2M_CreateRoleNew.oArg.name = name;
				rpcC2M_CreateRoleNew.oArg.type = type;
				XSingleton<XClientNetwork>.singleton.Send(rpcC2M_CreateRoleNew);
				this.SetBlockUIVisable(true);
			}
		}

		// Token: 0x06009698 RID: 38552 RVA: 0x0016C272 File Offset: 0x0016A472
		public void OnEnterWorldFailed(string error)
		{
			this.BackToLogin();
			XSingleton<UiUtility>.singleton.ShowLoginTip(string.Format("{0} {1}", this.PlatformComment(this._channel), string.IsNullOrEmpty(error) ? XStringDefineProxy.GetString("ENTER_WORLD_FAIL") : error));
		}

		// Token: 0x06009699 RID: 38553 RVA: 0x0016C2B2 File Offset: 0x0016A4B2
		public void OnEnterWorldTimeOut()
		{
			this.BackToLogin();
			XSingleton<UiUtility>.singleton.ShowLoginTip(string.Format("{0} {1}", this.PlatformComment(this._channel), XStringDefineProxy.GetString("ENTER_WORLD_TIMEOUT")));
		}

		// Token: 0x0600969A RID: 38554 RVA: 0x0016C2E8 File Offset: 0x0016A4E8
		public void EnableSDONotify()
		{
			if (!this._notification)
			{
				XSingleton<XUpdater.XUpdater>.singleton.XPlatform.ResgiterSDONotification(XSingleton<XClientNetwork>.singleton.ServerID, XSingleton<XEntityMgr>.singleton.Player.Name);
			}
			this._notification = true;
		}

		// Token: 0x0600969B RID: 38555 RVA: 0x0016C338 File Offset: 0x0016A538
		private void BackToBegin()
		{
			if (XSingleton<XClientNetwork>.singleton.XLoginStep != XLoginStep.Begin)
			{
				XSingleton<XAttributeMgr>.singleton.XPlayerCharacters.PlayerBriefInfo.Clear();
				XSingleton<XAttributeMgr>.singleton.XPlayerCharacters.SelectedSlot = 0;
				XSingleton<XClientNetwork>.singleton.XLoginStep = XLoginStep.Begin;
				XSingleton<XGame>.singleton.SwitchTo(EXStage.Login, 3U);
			}
		}

		// Token: 0x0600969C RID: 38556 RVA: 0x0016C398 File Offset: 0x0016A598
		private void BackToLogin()
		{
			if (XSingleton<XClientNetwork>.singleton.XLoginStep != XLoginStep.Login)
			{
				XSingleton<XAttributeMgr>.singleton.XPlayerCharacters.PlayerBriefInfo.Clear();
				XSingleton<XAttributeMgr>.singleton.XPlayerCharacters.SelectedSlot = 0;
				XSingleton<XClientNetwork>.singleton.XLoginStep = XLoginStep.Login;
				XSingleton<XGame>.singleton.SwitchTo(EXStage.Login, 3U);
			}
		}

		// Token: 0x0600969D RID: 38557 RVA: 0x0016C3F8 File Offset: 0x0016A5F8
		private void SaveAccount()
		{
			int num = XFastEnumIntEqualityComparer<XAuthorizationChannel>.ToInt(this._channel);
			string text = Application.persistentDataPath + "/account.txt";
			if ((Application.platform == RuntimePlatform.WindowsEditor) || (Application.platform == RuntimePlatform.OSXEditor) || (Application.platform == RuntimePlatform.WindowsPlayer))
			{
				text = Application.dataPath + "/account.txt";
			}
			try
			{
				File.WriteAllBytes(text, this.XCryptography(string.Format("{0}\n{1}\n{2}", num, this._account, this._pwd)));
				XSingleton<XUpdater.XUpdater>.singleton.XPlatform.SetNoBackupFlag(text);
			}
			catch (Exception ex)
			{
				XSingleton<XDebug>.singleton.AddErrorLog("Save account file error ", ex.Message, null, null, null, null);
			}
		}

		// Token: 0x0600969E RID: 38558 RVA: 0x0016C4C0 File Offset: 0x0016A6C0
		private void PlatformAuthorization()
		{
			XSingleton<XUpdater.XUpdater>.singleton.XPlatform.OnPlatformLogin();
		}

		// Token: 0x0600969F RID: 38559 RVA: 0x0016C4D3 File Offset: 0x0016A6D3
		private void QQAuthorization(bool auto)
		{
			XSingleton<XUpdater.XUpdater>.singleton.XPlatform.OnQQLogin();
		}

		// Token: 0x060096A0 RID: 38560 RVA: 0x0016C4E6 File Offset: 0x0016A6E6
		private void WeChatAuthorization(bool auto)
		{
			XSingleton<XUpdater.XUpdater>.singleton.XPlatform.OnWeChatLogin();
		}

		// Token: 0x060096A1 RID: 38561 RVA: 0x0016C4F9 File Offset: 0x0016A6F9
		private void GuestAuthorization(bool auto)
		{
			XSingleton<XUpdater.XUpdater>.singleton.XPlatform.OnGuestLogin();
		}

		// Token: 0x060096A2 RID: 38562 RVA: 0x0016C50C File Offset: 0x0016A70C
		private void InternalAuthorization(string account, string pwd)
		{
			this.OnAuthorization(account, pwd, account, XAuthorizationChannel.XAuthorization_Internal);
		}

		// Token: 0x060096A3 RID: 38563 RVA: 0x0016C51C File Offset: 0x0016A71C
		public void Update()
		{
			this._fetch_delay = false;
			this._login_delay = false;
			if (this._fetching_token)
			{
				if (this.FetchingElapsed > XLoginDocument._delay_notice_threshold)
				{
					this._fetch_delay = true;
				}
				if (this.FetchingElapsed > XLoginDocument._max_delay_notice_threshold)
				{
					this._fetching_token = false;
					this._fetch_delay = false;
					this.SetBlockUIVisable(false);
				}
			}
			if (this._logining && !this._in_server_queue)
			{
				if (this.LoginingElapsed > XLoginDocument._delay_notice_threshold)
				{
					if (this.LoginingElapsed > XLoginDocument._max_notice_threshold)
					{
						XSingleton<XClientNetwork>.singleton.Close(NetErrCode.Net_NoError);
						this.OnLoginTimeout();
					}
					else
					{
						this._login_delay = true;
					}
				}
			}
		}

		// Token: 0x060096A4 RID: 38564 RVA: 0x0016C5E8 File Offset: 0x0016A7E8
		private string PlatformComment(XAuthorizationChannel channel)
		{
			string result;
			switch (channel)
			{
			case XAuthorizationChannel.XAuthorization_Internal:
				result = "";
				break;
			case XAuthorizationChannel.XAuthorization_SD:
				result = XStringDefineProxy.GetString("SDO_TOKEN");
				break;
			case XAuthorizationChannel.XAuthorization_QQ:
				result = "QQ";
				break;
			case XAuthorizationChannel.XAuthorization_WeChat:
				result = XStringDefineProxy.GetString("WECHAT_TOKEN");
				break;
			case XAuthorizationChannel.XAuthorization_Guest:
				result = XStringDefineProxy.GetString("GUEST_TOKEN");
				break;
			default:
				result = "";
				break;
			}
			return result;
		}

		// Token: 0x060096A5 RID: 38565 RVA: 0x0016C658 File Offset: 0x0016A858
		private byte[] XCryptography(string content)
		{
			byte[] bytes = Encoding.UTF8.GetBytes(content);
			for (int i = 0; i < bytes.Length; i++)
			{
				bytes[i] ^= XLoginDocument._seed;
			}
			return bytes;
		}

		// Token: 0x060096A6 RID: 38566 RVA: 0x0016C698 File Offset: 0x0016A898
		private string XCryptography(byte[] content)
		{
			for (int i = 0; i < content.Length; i++)
			{
				content[i] ^= XLoginDocument._seed;
			}
			return Encoding.UTF8.GetString(content);
		}

		// Token: 0x060096A7 RID: 38567 RVA: 0x0016C6D8 File Offset: 0x0016A8D8
		public bool IsPublish()
		{
			return XSingleton<XUpdater.XUpdater>.singleton.XPlatform.IsPublish();
		}

		// Token: 0x060096A8 RID: 38568 RVA: 0x0016C6FC File Offset: 0x0016A8FC
		public void SetBlockUIVisable(bool state)
		{
			if (DlgBase<XLoginView, LoginWindowBehaviour>.singleton.IsVisible())
			{
				DlgBase<XLoginView, LoginWindowBehaviour>.singleton.uiBehaviour.m_BlockWindow.gameObject.SetActive(state);
			}
			if (DlgBase<XSelectCharView, SelectCharWindowBehaviour>.singleton.IsVisible())
			{
				DlgBase<XSelectCharView, SelectCharWindowBehaviour>.singleton.uiBehaviour.m_block.gameObject.SetActive(state);
			}
		}

		// Token: 0x060096A9 RID: 38569 RVA: 0x0016C760 File Offset: 0x0016A960
		public void ShowLoginUI()
		{
			if (DlgBase<XLoginView, LoginWindowBehaviour>.singleton.IsVisible())
			{
				DlgBase<XLoginView, LoginWindowBehaviour>.singleton.ShowLogin();
			}
		}

		// Token: 0x060096AA RID: 38570 RVA: 0x0016C78C File Offset: 0x0016A98C
		public void ShowLoginSelectServerUI()
		{
			if (DlgBase<XLoginView, LoginWindowBehaviour>.singleton.IsVisible())
			{
				if (string.IsNullOrEmpty(XSingleton<XClientNetwork>.singleton.XLoginToken))
				{
					this.AutoAuthorization(false);
				}
				this.ShowAfterLoginAnnouncement();
				DlgBase<XLoginView, LoginWindowBehaviour>.singleton.ShowSelectServer();
				DlgBase<XLoginView, LoginWindowBehaviour>.singleton.SetCurrentServer();
			}
		}

		// Token: 0x060096AB RID: 38571 RVA: 0x0016C7EC File Offset: 0x0016A9EC
		public void ShowSelectCharGerenalUI()
		{
			if (DlgBase<XSelectCharView, SelectCharWindowBehaviour>.singleton.IsVisible())
			{
				DlgBase<XSelectCharView, SelectCharWindowBehaviour>.singleton.ShowSelectCharGerenal();
			}
		}

		// Token: 0x060096AC RID: 38572 RVA: 0x0016C818 File Offset: 0x0016AA18
		public void ShowSelectCharSelectedUI(string name, int level)
		{
			if (DlgBase<XSelectCharView, SelectCharWindowBehaviour>.singleton.IsVisible())
			{
				DlgBase<XSelectCharView, SelectCharWindowBehaviour>.singleton.ShowSelectCharSelected(name, level);
			}
		}

		// Token: 0x060096AD RID: 38573 RVA: 0x0016C848 File Offset: 0x0016AA48
		public void ShowSelectCharCreatedUI()
		{
			if (DlgBase<XSelectCharView, SelectCharWindowBehaviour>.singleton.IsVisible())
			{
				DlgBase<XSelectCharView, SelectCharWindowBehaviour>.singleton.ShowSelectCharCreated();
			}
		}

		// Token: 0x060096AE RID: 38574 RVA: 0x0016C874 File Offset: 0x0016AA74
		public void SetLoginZoneID(uint loginZoneId)
		{
			this._login_zoneid = loginZoneId;
		}

		// Token: 0x060096AF RID: 38575 RVA: 0x0016C87E File Offset: 0x0016AA7E
		public void SetAnnouncement(PlatNotice announcement)
		{
			this._announcement = announcement;
		}

		// Token: 0x060096B0 RID: 38576 RVA: 0x0016C888 File Offset: 0x0016AA88
		public void SetFreeflow(bool _free, int _type)
		{
			this._freeflow = _free;
			this._cctype = _type;
		}

		// Token: 0x060096B1 RID: 38577 RVA: 0x0016C89C File Offset: 0x0016AA9C
		public void SetGateIPTable(List<SelfServerData> myServersList, byte[] bytes, List<LoginGateData> serverList)
		{
			this._server_dic.Clear();
			this._server_category.Clear();
			this._zone_list.Clear();
			this.BackFlowServerList.Clear();
			for (int i = serverList.Count - 1; i >= 0; i--)
			{
				LoginGateData loginGateData = serverList[i];
				if (loginGateData.isbackflow)
				{
					bool flag = true;
					for (int j = 0; j < this.BackFlowServerList.Count; j++)
					{
						if (this.BackFlowServerList[j].ServerID == loginGateData.serverid)
						{
							flag = false;
							break;
						}
					}
					if (flag)
					{
						this.BackFlowServerList.Add(this.CreateServerInfoData(loginGateData.serverid, loginGateData.servername, loginGateData.zonename, loginGateData.ip, (uint)loginGateData.port, (int)loginGateData.state, (int)loginGateData.flag, loginGateData.backflowlevel));
					}
					serverList.RemoveAt(i);
				}
			}
			string @string = XSingleton<XStringTable>.singleton.GetString("MYSELF_SERVERS");
			this._server_category.Add(@string, new List<int>());
			this._zone_list.Add(@string);
			string string2 = XSingleton<XStringTable>.singleton.GetString("BACK_SERVERS");
			if (this.BackFlowServerList.Count > 0)
			{
				this._zone_list.Add(string2);
				this._server_category.Add(string2, new List<int>());
			}
			string string3 = XSingleton<XStringTable>.singleton.GetString("FRIENDS_SERVERS");
			this._server_category.Add(string3, new List<int>());
			this._zone_list.Add(string3);
			if (myServersList.Count == 0)
			{
				XSingleton<UiUtility>.singleton.ShowModalDialog(XStringDefineProxy.GetString("TRUE_NAME_TIP"), XStringDefineProxy.GetString("COMMON_OK"));
			}
			for (int k = 0; k < myServersList.Count; k++)
			{
				this._server_category[@string].Add(myServersList[k].servers.serverid);
				if (!this._server_dic.ContainsKey(myServersList[k].servers.serverid))
				{
					List<string> list = new List<string>();
					list.Add(string.Format("{0}:{1}", myServersList[k].servers.ip, myServersList[k].servers.port));
					this._server_dic.Add(myServersList[k].servers.serverid, this.CreateServerInfoData(myServersList[k].servers.serverid, myServersList[k].servers.servername, myServersList[k].servers.zonename, myServersList[k].servers.ip, (uint)myServersList[k].servers.port, (int)myServersList[k].servers.state, (int)myServersList[k].servers.flag, myServersList[k].level));
				}
				for (int l = 0; l < this._backFlowServerList.Count; l++)
				{
					if (this._backFlowServerList[l].ServerID == myServersList[k].servers.serverid)
					{
						this._backFlowServerList[l].Level = myServersList[k].level;
					}
				}
			}
			for (int m = 0; m < serverList.Count; m++)
			{
				if (!this._server_category.ContainsKey(serverList[m].zonename))
				{
					this._server_category.Add(serverList[m].zonename, new List<int>());
					this._zone_list.Add(serverList[m].zonename);
				}
				this._server_category[serverList[m].zonename].Add(serverList[m].serverid);
				if (!this._server_dic.ContainsKey(serverList[m].serverid))
				{
					this._server_dic.Add(serverList[m].serverid, this.CreateServerInfoData(serverList[m].serverid, serverList[m].servername, serverList[m].zonename, serverList[m].ip, (uint)serverList[m].port, (int)serverList[m].state, (int)serverList[m].flag, 0U));
				}
			}
			for (int n = 0; n < this.BackFlowServerList.Count; n++)
			{
				this._server_category[string2].Add(this.BackFlowServerList[n].ServerID);
				if (!this._server_dic.ContainsKey(this.BackFlowServerList[n].ServerID))
				{
					this._server_dic.Add(this.BackFlowServerList[n].ServerID, this.BackFlowServerList[n]);
				}
			}
		}

		// Token: 0x060096B2 RID: 38578 RVA: 0x0016CE48 File Offset: 0x0016B048
		public void SetFriendServerList(List<PlatFriendServer> friendList)
		{
			this.FriendServerDic.Clear();
			this.FriendOpenid.Clear();
			for (int i = 0; i < friendList.Count; i++)
			{
				ServerInfo serverData = this.GetServerData(friendList[i].serverid);
				if (serverData != null)
				{
					if (!XSingleton<XGame>.singleton.IsGMAccount)
					{
						if (serverData.StateTxt == 6)
						{
							goto IL_C4;
						}
					}
					FriendServerInfo friendServerInfo = new FriendServerInfo();
					friendServerInfo.info = friendList[i];
					friendServerInfo.account = "";
					friendServerInfo.icon = "";
					this.FriendServerDic[friendList[i].openid] = friendServerInfo;
					this.FriendOpenid.Add(friendList[i].openid);
				}
				IL_C4:;
			}
			XSingleton<XUpdater.XUpdater>.singleton.XPlatform.SendGameExData("QueryFriends", "");
		}

		// Token: 0x060096B3 RID: 38579 RVA: 0x0016CF4C File Offset: 0x0016B14C
		public void SetFriendServerIcon()
		{
			for (int i = 0; i < XSingleton<PDatabase>.singleton.friendsInfo.data.Length; i++)
			{
				if (this.FriendServerDic.ContainsKey(XSingleton<PDatabase>.singleton.friendsInfo.data[i].openId))
				{
					this.FriendServerDic[XSingleton<PDatabase>.singleton.friendsInfo.data[i].openId].account = XSingleton<PDatabase>.singleton.friendsInfo.data[i].nickName;
					this.FriendServerDic[XSingleton<PDatabase>.singleton.friendsInfo.data[i].openId].icon = XSingleton<PDatabase>.singleton.friendsInfo.data[i].pictureLarge;
				}
			}
		}

		// Token: 0x060096B4 RID: 38580 RVA: 0x0016D038 File Offset: 0x0016B238
		public ServerInfo CreateServerInfoData(int serverID, string serverName, string zoneName, string ip, uint port, int state, int stateTxt, uint level)
		{
			return new ServerInfo
			{
				ServerID = serverID,
				ServerName = serverName,
				ZoneName = zoneName,
				Ip = ip,
				Port = port,
				State = state,
				StateTxt = stateTxt,
				Level = level
			};
		}

		// Token: 0x060096B5 RID: 38581 RVA: 0x0016D090 File Offset: 0x0016B290
		public ServerInfo GetServerData(int id)
		{
			ServerInfo serverInfo;

			if (this._server_dic.TryGetValue(id, out serverInfo))
			{
				return serverInfo;
			}
			return null;
		}

		// Token: 0x060096B6 RID: 38582 RVA: 0x0016D0BC File Offset: 0x0016B2BC
		public void OnServerChanged(int id)
		{
			ServerInfo serverData = this.GetServerData(id);
			if (serverData != null)
			{
				if (XSingleton<XClientNetwork>.singleton.OnServerChanged(serverData))
				{
					this._view.SetCurrentServer();
				}
			}
		}

		// Token: 0x060096B7 RID: 38583 RVA: 0x0016D0FC File Offset: 0x0016B2FC
		public bool OnLoginForbidClick(IXUIButton btn)
		{
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
			this.BackToLogin();
			return true;
		}

		// Token: 0x060096B8 RID: 38584 RVA: 0x0016D123 File Offset: 0x0016B323
		public void SetLoginReconnect(LoginReconnectInfo info)
		{
			this._login_reconnect_info = info;
		}

		// Token: 0x060096B9 RID: 38585 RVA: 0x0016D130 File Offset: 0x0016B330
		public void ShowLoginReconnect()
		{
			bool flag = this._login_reconnect_info == null || this._login_reconnect_info.scenetemplateid == 0U;
			if (!flag)
			{
				SceneTable.RowData sceneData = XSingleton<XSceneMgr>.singleton.GetSceneData(this._login_reconnect_info.scenetemplateid);
				string @string = XStringDefineProxy.GetString("LOGIN_RECONNECT_TIP", new object[]
				{
					(sceneData != null) ? sceneData.Comment : ""
				});
				XSingleton<UiUtility>.singleton.ShowModalDialog(@string, XStringDefineProxy.GetString("COMMON_OK"), XStringDefineProxy.GetString("COMMON_CANCEL"), new ButtonClickEventHandler(this.OnStartLoginReconnectClicked), new ButtonClickEventHandler(this.OnCancelLoginReconnectClicked), false, XTempTipDefine.OD_START, 50);
			}
		}

		// Token: 0x060096BA RID: 38586 RVA: 0x0016D1D4 File Offset: 0x0016B3D4
		private bool OnStartLoginReconnectClicked(IXUIButton btn)
		{
			RpcC2N_LoginReconnectReq rpcC2N_LoginReconnectReq = new RpcC2N_LoginReconnectReq();
			rpcC2N_LoginReconnectReq.oArg.reconnect = true;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2N_LoginReconnectReq);
			this._login_reconnect_info = null;
			this.SetBlockUIVisable(true);
			return true;
		}

		// Token: 0x060096BB RID: 38587 RVA: 0x0016D218 File Offset: 0x0016B418
		private bool OnCancelLoginReconnectClicked(IXUIButton btn)
		{
			RpcC2N_LoginReconnectReq rpcC2N_LoginReconnectReq = new RpcC2N_LoginReconnectReq();
			rpcC2N_LoginReconnectReq.oArg.reconnect = false;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2N_LoginReconnectReq);
			this._login_reconnect_info = null;
			this.SetBlockUIVisable(true);
			return true;
		}

		// Token: 0x04003330 RID: 13104
		private static readonly byte _seed = 148;

		// Token: 0x04003331 RID: 13105
		private static readonly float _delay_notice_threshold = 0.5f;

		// Token: 0x04003332 RID: 13106
		private static readonly float _max_delay_notice_threshold = 10f;

		// Token: 0x04003333 RID: 13107
		private static readonly float _max_notice_threshold = 5f;

		// Token: 0x04003334 RID: 13108
		private XAuthorizationChannel _channel = XAuthorizationChannel.XAuthorization_Max;

		// Token: 0x04003335 RID: 13109
		private XLoginView _view = null;

		// Token: 0x04003336 RID: 13110
		private PlatNotice _announcement = null;

		// Token: 0x04003337 RID: 13111
		private bool _sdk_sign_out = false;

		// Token: 0x04003338 RID: 13112
		private bool _after_login_announcement = false;

		// Token: 0x04003339 RID: 13113
		private bool _notification = false;

		// Token: 0x0400333A RID: 13114
		private bool _authorized = false;

		// Token: 0x0400333B RID: 13115
		private bool _auto_authorization = false;

		// Token: 0x0400333C RID: 13116
		private string _account = null;

		// Token: 0x0400333D RID: 13117
		private string _pwd = null;

		// Token: 0x0400333E RID: 13118
		private string __openid = null;

		// Token: 0x0400333F RID: 13119
		private uint _login_zoneid = 0U;

		// Token: 0x04003340 RID: 13120
		private bool _freeflow;

		// Token: 0x04003341 RID: 13121
		private int _cctype;

		// Token: 0x04003342 RID: 13122
		private string _token_cache = null;

		// Token: 0x04003343 RID: 13123
		private bool _fetch_delay = false;

		// Token: 0x04003344 RID: 13124
		private bool _fetching_token = false;

		// Token: 0x04003345 RID: 13125
		private float _last_fetch_at = 0f;

		// Token: 0x04003346 RID: 13126
		private bool _authorized_from_login_stage = false;

		// Token: 0x04003347 RID: 13127
		private bool _login_delay = false;

		// Token: 0x04003348 RID: 13128
		private bool _logining = false;

		// Token: 0x04003349 RID: 13129
		private float _last_login_at = 0f;

		// Token: 0x0400334A RID: 13130
		private bool _in_server_queue = false;

		// Token: 0x0400334B RID: 13131
		private float enterWorldTime = 0f;

		// Token: 0x0400334C RID: 13132
		private List<string> _zone_list = new List<string>();

		// Token: 0x0400334D RID: 13133
		private Dictionary<string, List<int>> _server_category = new Dictionary<string, List<int>>();

		// Token: 0x0400334E RID: 13134
		private Dictionary<int, ServerInfo> _server_dic = new Dictionary<int, ServerInfo>();

		// Token: 0x0400334F RID: 13135
		private List<ServerInfo> _backFlowServerList = new List<ServerInfo>();

		// Token: 0x04003350 RID: 13136
		public Dictionary<string, FriendServerInfo> FriendServerDic = new Dictionary<string, FriendServerInfo>();

		// Token: 0x04003351 RID: 13137
		public List<string> FriendOpenid = new List<string>();

		// Token: 0x04003352 RID: 13138
		private uint _role_count_inqueue = 0U;

		// Token: 0x04003353 RID: 13139
		private uint _left_time_inqueue = 0U;

		// Token: 0x04003354 RID: 13140
		private LoginReconnectInfo _login_reconnect_info = null;

		// Token: 0x04003355 RID: 13141
		private uint _query_queue_token = 0U;

		// Token: 0x04003356 RID: 13142
		private float[] lastLoginTime = new float[2];

		// Token: 0x04003357 RID: 13143
		private StartUpType _LaunchTypeServer = StartUpType.StartUp_Normal;
	}
}
